<?php $this->pageTitle=Yii::app()->name; ?>
 
<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'job-form',
	//'enableClientValidation'=>true,
	//'enableAjaxValidation'=>true,
	'htmlOptions' => array('enctype' => 'multipart/form-data',)
)); ?>
<?php if(Yii::app()->user->hasFlash('error1')):?>
    	<div class="info" style="color: red;">
        	<?php echo Yii::app()->user->getFlash('error1'); ?>
    	</div>
	<?php endif; ?>
<?php 
if (Yii::app()->user->isGuest){
        $tabs = array();
        $tabs['Đã có tài khoản '] = $this->renderPartial('/job/login_newjob',array('login'=>$login), true);
        $tabs['Thêm người dùng mới'] = $this->renderPartial('/job/signup_newjob',array('user'=>$user), true);  
        $this->widget('zii.widgets.jui.CJuiTabs', array(
                'tabs'=>$tabs,        
                'options'=>array(
                    'collapsible'=>true,
                    'select' => $tabs,
                ),
        ));
    }
?>
<div class="row">
		<?php echo $form->labelEx($model,'name'); ?>
		<?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'name'); ?>
	</div>

	<div class="row">

		<?php echo $form->labelEx($model,'jobtype_id'); ?>
		<?php echo CHtml::dropDownList('jobtype_id','',$model->getJobType(),array('prompt' => 'Chọn một lĩnh vực',
                    'ajax' => array(
                    'type'=>'POST', //request type
                    'url'=>CController::createUrl('Job/ajaxDropDown'), //url to call.
                    //Style: CController::createUrl('currentController/methodToCall')
                    'update'=>'#subjobtype_id', //selector to update
                    //'data'=>'js:javascript statement' 
                    //leave out the data key to pass all form values through
                    )));  
            
?>
		<?php echo $form->error($model,'jobtype_id'); ?>

	</div>
    <div class="row" id="chonlinhvuc" style="display: none;">
		<?php echo $form->labelEx($model,'subjobtype_id'); ?>
		<?php echo CHtml::dropDownList('subjobtype_id','', array()); ?>
		<?php echo $form->error($model,'subjobtype_id'); ?>
        </div>
	<div class="row">
		<?php echo $form->labelEx($model,'skillsrequired'); ?>
		<?php echo $form->textField($model,'skillsrequired',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'skillsrequired'); ?>
        </div>

	<div class="row">
		<?php echo $form->labelEx($model,'duration'); ?>
		<?php echo $form->textField($model,'duration',array('size'=>60,'maxlength'=>100)); ?>
		<?php echo $form->error($model,'duration'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'budget_id'); ?>
        <?php echo CHtml::dropDownList('currency','',array('VNĐ'=>'VNĐ','USD'=>'USD'),array(
                    'ajax' => array(
                    'type'=>'POST', //request type
                    'url'=>CController::createUrl('Job/ajaxCurrency'), //url to call.
                    //Style: CController::createUrl('currentController/methodToCall')
                    'update'=>'#'.CHtml::activeId($model,'budget_id'), //selector to update
                    //'data'=>'js:javascript statement' 
                    //leave out the data key to pass all form values through
                    )));  
            
?>
		<?php echo $form->dropDownlist($model,'budget_id',$model->getBudgetId(), array('prompt' => 'Chọn khoảng tiền')); ?>
		<?php echo $form->error($model,'budget_id'); ?>
	</div>
        
	<div class="row">
		<?php echo $form->labelEx($model,'biddingperiod'); ?>
		<?php echo $form->textField($model,'biddingperiod'); ?>
		<?php echo $form->error($model,'biddingperiod'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'jobdesc'); ?>
		<?php echo $form->textArea($model,'jobdesc',array('rows'=>10, 'cols'=>80)); ?>
		<?php echo $form->error($model,'jobdesc'); ?>
	</div>
	<div class="row">
            <?php
                echo $form->labelEx($model,'fileattached');
                echo Chtml::activeFileField($model, 'fileattached');
                echo Chtml::error($model, 'fileattached');
            ?>
	</div>
        Chú ý: Bạn không được đăng tải bất cứ thông tin cá nhân nào trên website này!!

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->